class MyInstance {
	constructor() {}
}

function singleton(className) {
	let ins;
	const proxy = new Proxy(className, {
		construct(target, args) {
			if (ins) {
				return ins;
			}
			ins = Reflect.construct(target, args);
			return ins;
		}
	});
	proxy.prototype.constructor = proxy;
	return proxy;
}

const MySingleton = singleton(MyInstance);

export default new MySingleton();
